package com.ywy.dao;

import com.ywy.entity.Comment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * 评论Repository接口
 *
 * @author ywy
 * @date 2022/9/8 17:18
 */
public interface CommentDao extends JpaRepository<Comment, Integer>, JpaSpecificationExecutor<Comment> {
    /**
     * 删除指定资源的评论信息
     * @param resId
     */
    @Modifying
    @Query(value = "delete from sys_comment where res_id=?1", nativeQuery = true)
    void deleteByResId(Integer resId);
}
